package com.example.Object;

import java.util.Objects;

public class Test3Object {
    public static void main(String[] args) {
        Student1 s1 = new Student1("李四", 16);
        String result = Objects.toString(s1);
        System.out.println(result); // Student1{age=16, name='李四'}
        //System.out.println(s1);

        Student1 s2 = new Student1();
        s2 = null;
        String s = Objects.toString(s2, "随便");
        System.out.println(s); //随便

        Student1 s3 = new Student1();
        s3 = null;
        boolean aNull = Objects.isNull(s3);
        System.out.println(aNull);  //true

        Student1 s4 = new Student1();
        s4 = null;
        boolean bNull = Objects.nonNull(s4);
        System.out.println(bNull);  //false
    }
}
